#pragma once
#include <iostream>
#include <ctime>
#include <stdio.h>
#include <stdarg.h>
using namespace std;
#define DEBUG 0
#define NORMAL 1
#define WARNING 2
#define ERROR 3
#define FATAL 4
#define NUM 1024
const char *getLevel(const int &level)
{
    switch (level)
    {
    case 0:
        return "DEBUG";
    case 1:
        return "NORMAL";
    case 2:
        return "WARNING";
    case 3:
        return "ERROR";
    case 4:
        return "FATAL";
    default:
        return nullptr;
    }
}
void logMessage(int level, const char *format, ...)
{
    char logprefix[NUM];
    sprintf(logprefix, "[%s][%ld]:", getLevel(level), time(nullptr));
    char logContext[NUM];
    va_list arg;
    va_start(arg, format);
    vsnprintf(logContext, sizeof(logContext), format, arg);
    cout << logprefix << logContext << endl;
}